package com.taxshare.api.controller;

import com.taxshare.api.service.InvoiceAuthService;
import com.taxshare.api.view.dto.*;

import com.taxshare.response.beans.Response;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lzy
 * @title: InvoiceAuthController
 * @projectName pingan
 * @description: 进项认证接口
 * @date 2021-03-28 17:54
 */
@RestController
@RequestMapping("/purchaserAuth")
public class InvoiceAuthController {
    @Autowired
    private InvoiceAuthService invoiceAuthService;

    @PostMapping("/invoice/auth")
    @ApiOperation(value = "发票认证", notes = "发票认证")
    public Response auth(@RequestBody InvoiceAuthBodyDTO bean) {
        return invoiceAuthService.auth(bean);
    }

    @PostMapping("/invoice/apply")
    @ApiOperation(value = "发票认证申请", notes = "发票认证申请")
    public Response apply(@RequestBody ApplyDTO bean) {
        return invoiceAuthService.apply(bean);
    }

    @PostMapping("/invoice/applyResult")
    @ApiOperation(value = "发票认证申请结果", notes = "发票认证申请结果")
    public Response applyResult(@RequestBody ApplyResultDTO bean) {
        return invoiceAuthService.applyResult(bean);
    }

    @PostMapping("/invoice/confirm")
    @ApiOperation(value = "发票认证申请签名确认", notes = "发票认证申请签名确认")
    public Response confirm(@RequestBody ConfirmApplyDTO bean) {
        return invoiceAuthService.confirm(bean);
    }

    @PostMapping("/invoice/confirmResult")
    @ApiOperation(value = "发票认证申请签名确认结果", notes = "发票认证申请签名确认结果")
    public Response confirmResult(@RequestBody ConfirmApplyResultDTO bean) {
        return invoiceAuthService.confirmResult(bean);
    }

    @PostMapping("/invoice/sync")
    @ApiOperation(value = "电子底账同步", notes = "电子底账同步")
    public Response sync(@RequestBody InvoiceSyncDTO bean) {
        return invoiceAuthService.sync(bean);
    }

    @PostMapping("/company/period")
    @ApiOperation(value = "同步税款所属期", notes = "同步税款所属期")
    public Response period(@RequestBody String purchaserTaxNo) {
        return invoiceAuthService.period(purchaserTaxNo);
    }
}
